﻿using System;
using DapperExtensions.Mapper;
using Newtonsoft.Json;

namespace ZilLion.Service.WeChatMall.Domain.Entitys.AppInfo
{
    public class AppBasicInfoEntity
    {
        /// <summary>
        ///     商户ID（使用微信APPID作为商户ID）
        /// </summary>
        [JsonProperty("appid")]
        public string AppId { get; set; }

        /// <summary>
        ///     纵联商城接入关键字
        /// </summary>
        [JsonProperty("zlcompanykey")]
        public string ZlCompanyKey { get; set; }


        /// <summary>
        ///     商户名称
        /// </summary>
        [JsonProperty("appname")]
        public string AppName { get; set; }

        /// <summary>
        ///     商户首页显示方式（0-店铺列表，1-单店铺展示）
        /// </summary>
        [JsonProperty("apphometype")]
        public short AppHomeType { get; set; }

        /// <summary>
        ///     如果首页展示方式为单店铺,制定的店铺ID
        /// </summary>
        [JsonProperty("mainshopid")]
        public long MainShopid { get; set; }

        /// <summary>
        ///     首页跑马灯,隔开
        /// </summary>
        [JsonProperty("swipepics")]
        public string SwipePics { get; set; }


        /// <summary>
        ///     配送范围 单位km
        /// </summary>
        [JsonProperty("sendrange")]
        public decimal SendRange { get; set; }

        /// <summary>
        ///     app crm 网关
        /// </summary>
        [JsonProperty("crmapigetway")]
        public string CrmApiGetWay { get; set; }

        /// <summary>
        ///     app领卡二维码url
        /// </summary>
        [JsonProperty("crmqrcodeurl")]
        public string CrmQrCodeUrl { get; set; }


        /// <summary>
        ///     修改时间
        /// </summary>
        [JsonProperty("updatedtime")]
        public DateTime UpdatedTime { get; set; }

        /// <summary>
        ///     修改人
        /// </summary>
        [JsonProperty("updater")]
        public long Updater { get; set; }

        /// <summary>
        ///     默认城市名称
        /// </summary>
        [JsonProperty("cityname")]
        public string CityName { get; set; }

        /// <summary>
        ///     gps地址
        /// </summary>
        [JsonProperty("citycenter")]
        public string CityCenter { get; set; }

        /// <summary>
        ///     行政区域code(省份证前缀)
        /// </summary>
        [JsonProperty("cityadcode")]
        public string CityAdcode { get; set; }


        /// <summary>
        ///     快速备注(都好隔开)
        /// </summary>
        [JsonProperty("fixedremarks")]
        public string FixedRemarks { get; set; }
    }


    public sealed class AppBasicInfoEntityMapper : ClassMapper<AppBasicInfoEntity>
    {
        public AppBasicInfoEntityMapper()
        {
            Table("appbasicinfo");
            Map(f => f.AppId).Column("appid").Key(KeyType.Assigned);
            Map(f => f.ZlCompanyKey).Column("zlcompanykey");
            Map(f => f.AppName).Column("appname");
            Map(f => f.MainShopid).Column("mainshopid");
            Map(f => f.SwipePics).Column("swipepics");
            Map(f => f.SendRange).Column("sendrange");
            Map(f => f.AppHomeType).Column("apphometype");
            Map(f => f.CrmApiGetWay).Column("crmapigetway");
            Map(f => f.CrmQrCodeUrl).Column("crmqrcodeurl");
            Map(f => f.UpdatedTime).Column("updatedtime");
            Map(f => f.Updater).Column("updater");
            Map(f => f.CityName).Column("cityname");
            Map(f => f.CityCenter).Column("citycenter");
            Map(f => f.CityAdcode).Column("cityadcode");
            Map(f => f.FixedRemarks).Column("fixedremarks");
        }
    }
}